#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>

typedef long long ll;

int weights[20] = {0,7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
char check[15] = {'1','0','x','9','8','7','6','5','4','3','2'};

int main(){
	char s[20];
	int i,sum=0;
	while((scanf("%s",s+1)) != EOF){
		sum = 0; 
		for(i=1;i<=17;i++){
			sum+=(s[i]-'0')*weights[i];
		}
		sum = sum%11;
		printf("%c\n",check[sum]);
	}
	
	return 0;
}
